home *** CD-ROM | disk | FTP | other *** search
- Path: news.erg.cuhk.hk!usenet
- From: Lawrence Xiao <hkshiou3@se.cuhk.hk>
- Newsgroups: comp.lang.c
- Subject: floating point dynamic array
- Date: Tue, 30 Jan 1996 21:25:20 -0800
- Organization: Engineering Faculty CUHK
- Message-ID: <310EFD40.2D03@se.cuhk.hk>
- NNTP-Posting-Host: slip11.erg.cuhk.hk
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b6a (Win16; I)
-
- Hi all,
-
- I try to use dynamic array to store series of floating point.
- But error message returns. However, there won't be any problem
- when I change the all the declaration from floating point
- to integer.
-
- The message I get is:
- "scanf: floating point formats not linked"
- "abnormal program termination"
-
- The program is as follows:
-
- #include <stdio.h>
- #include <stdlib.h>
-
- main()
- {
- int n, k;
- float *base, *ptr;
-
- scanf("%d", &n);
- base=calloc(n, sizeof(float));
- for(ptr=base, k=0;k<n;k++)
- scanf("%f", ptr++);
- for(ptr=base+n, k=0;k<n;k++)
- printf("%f\n", *(--ptr));
- free(base);
- }
-
-
- Can anybody here can drew some light on it?
-
- Lawrence
-